package com.frame.exception

import org.slf4j.Logger
import org.slf4j.LoggerFactory

import javax.ws.rs.NotAllowedException
import javax.ws.rs.core.Response
import javax.ws.rs.ext.ExceptionMapper
import javax.ws.rs.ext.Provider

/**
 * Created by three on 14-8-4.
 */
@Provider
class NotAllowedExceptionMapper implements ExceptionMapper<NotAllowedException> {

    private Logger log = LoggerFactory.getLogger(NotAllowedExceptionMapper.class);

    @Override
    Response toResponse(NotAllowedException exception) {
        return Response.status(Response.Status.METHOD_NOT_ALLOWED).entity("请求不允许："+exception.getMessage()).
                type("text/plain").build();
    }
}
